RichText and variable

Keve G??borKeve G??bor hungary
edited 6:34PM in FastReport .NET
Hello!

This little code + report generate 2 page PDF file.
FastReport.Report fr = new FastReport.Report();
            fr.Load("example.frx");
            fr.Report.SetParameterValue("RTFText", "{\\rtf1\\ansi\\ansicpg1250\\deff0\\deflang1038{\\fonttbl{\\f0\\fscript\\fprq2\\fcharset238 Comic Sans MS;}{\\f1\\fswiss\\fcharset238{\\*\\fname Arial;}Arial CE;}}{\\colortbl ;\\red255\\green0\\blue0;}{\\*\\generator Msftedit 5.41.15.1515;}\\viewkind4\\uc1\\pard\\cf1\\f0\\fs56 Example\\cf0\\f1\\fs20  \\b Text\\b0\\par}");
            fr.Prepare();
            fr.Export(new FastReport.Export.Pdf.PDFExport(), "example.pdf");

In the first page, i set the Rich1.Text with RTFText variable from code. The second page i put the RTFText variable in the RichObject text field.

As You can see, the first page ok, but the second page contains the text of the RTFText object, but not the expected (RichText interpretered and processed) result.

Is this normal? How can i put RichText from variable to RichObject?


regards,
Gabor Keve

p.s.: report attached ZIP format, cause i cannot attach FRX file! >

Comments

  • edited 6:34PM
    Hello,
    wrote:
    How can i put RichText from variable to RichObject?
    You can use following code:
    FastReport.Report fr = new FastReport.Report();
    fr.Load("example.frx");
    
    // first way
    RichObject rich1 = fr.FindObject("Rich1") as RichObject;
    rich1.Text = @"{\\rtf1\\ansi\\ansicpg1250\\deff0\\deflang1038{\\fonttbl{\\f0\\fscript\\fprq2\\fcharset238 Comic Sans MS;}{\\f1\\fswiss\\fcharset238{\\*\\fname Arial;}Arial CE;}}{\\colortbl;\\red255\\green0\\blue0;}{\\*\\generator Msftedit 5.41.15.1515;}\\viewkind4\\uc1\\pard\\cf1\\f0\\fs56 Example\\cf0\\f1\\fs20 \\b Text\\b0\\par}";
    
    // second way
    RichObject rich2 = fr.FindObject("Rich2") as RichObject;
    rich.RichTextBox.Rtf = @"{\\rtf1\\ansi\\ansicpg1250\\deff0\\deflang1038{\\fonttbl{\\f0\\fscript\\fprq2\\fcharset238 Comic Sans MS;}{\\f1\\fswiss\\fcharset238{\\*\\fname Arial;}Arial CE;}}{\\colortbl;\\red255\\green0\\blue0;}{\\*\\generator Msftedit 5.41.15.1515;}\\viewkind4\\uc1\\pard\\cf1\\f0\\fs56 Example\\cf0\\f1\\fs20 \\b Text\\b0\\par}";
    

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.